package bai5.model;

import java.util.Scanner;

import bai3.App;

public class Timesheet {
	public static final String SER_STATUS_SUCSESS = "YES";
	public static final String SER_STATUS_EROOR = "NO";
	private int id;
	private String name;
	private String date;
	private int duration;
	private String description;
	private String activity;
	private int overtime;
	private String location;
	private String nameEmployee;
	private String nameProject;
	public Timesheet(){
		
	}
	public Timesheet(int id, String name, String date, int duration,
			String description, String activity, int overtime,
			String location, String nameEmployee, String nameProject) {
		super();
		this.id = id;
		this.name = name;
		this.date = date;
		this.duration = duration;
		this.description = description;
		this.activity = activity;
		this.overtime = overtime;
		this.location = location;
		this.nameEmployee = nameEmployee;
		this.nameProject = nameProject;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getDate() {
		return date;
	}
	public void setDate(String date) {
		this.date = date;
	}
	public int getDuration() {
		return duration;
	}
	public void setDuration(int duration) {
		this.duration = duration;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public String getActivity() {
		return activity;
	}
	public void setActivity(String activity) {
		this.activity = activity;
	}
	public int getOvertime() {
		return overtime;
	}
	public void setOvertime(int overtime) {
		this.overtime = overtime;
	}
	public String getLocation() {
		return location;
	}
	public void setLocation(String location) {
		this.location = location;
	}
	public String getNameEmployee() {
		return nameEmployee;
	}
	public void setNameEmployee(String nameEmployee) {
		this.nameEmployee = nameEmployee;
	}
	public String getNameProject() {
		return nameProject;
	}
	public void setNameProject(String nameProject) {
		this.nameProject = nameProject;
	}
	public Timesheet inputTimesheet(){
		Scanner ip=new Scanner(System.in);
		System.out.println("==========hem moi Timesheet===========");
		System.out.println("Nhap Id: ");
		int id=Integer.parseInt(ip.nextLine());
		System.out.println("Nhap Ngay: ");
		String date=ip.nextLine();
		while(date.trim().equalsIgnoreCase("")){
			System.out.println("Chua nhap gia tri");
			date=ip.nextLine();
		}
		if(!App.isValidDate(date)){
			System.out.println("Nhap khong dung dinh dang. Vui long nhap lai!");
			date=ip.nextLine();
		}
		System.out.println("Nhap thoi gian: ");
		int duration=Integer.parseInt(ip.nextLine());
		System.out.println("Nhap mo ta:");
		String description=ip.nextLine();
		while(description.trim().equalsIgnoreCase("")){
			System.out.println("Chua nhap gia tri");
			description=ip.nextLine();
		}
		System.out.println("Nhap pham vi: ");
		String activity=ip.nextLine();
		while(activity.trim().equalsIgnoreCase("")){
			System.out.println("Chua nhap gia tri");
			String activivy=ip.nextLine();
		}
		System.out.println("Nhap thong tin lam them: ");
		System.out.println("1.YES");
		System.out.println("2.NO");
		int overtime=Integer.parseInt(ip.nextLine());
		System.out.println("Nhap vi tri: ");
		String location=ip.nextLine();
		while(location.trim().equalsIgnoreCase("")){
			System.out.println("Chua nhap gia tri");
			location=ip.nextLine();
		}
		System.out.println("Nhap ten nhan vien:");
		String nameEmployee=ip.nextLine();
		while(nameEmployee.trim().equalsIgnoreCase("")){
			System.out.println("Chua nhap gia tri");
			nameEmployee=ip.nextLine();
		}
		System.out.println("Nhap ten du an:");
		String nameProject=ip.nextLine();
		while(nameProject.trim().equalsIgnoreCase("")){
			System.out.println("Chua nhap gia tri");
			nameProject=ip.nextLine();
		}
		Timesheet ts=new Timesheet(id,name,date, duration,description,activity,overtime,location,nameEmployee,nameProject);
		return ts;	
	}
	public static String checkOvertime(int i){
		if(i==1)
			return SER_STATUS_SUCSESS;
		    return SER_STATUS_EROOR;
	}
	public void display(Timesheet ts){
		System.out.println("Id vua nhap la: "+ts.id);
		System.out.println("Ngay vua nhap vao la:  "+ts.date);
		System.out.println("Thoi gian vua nhap vao la:  "+ts.duration);
		System.out.println("Mo ta vua nhap vao:  "+ts.description);
		System.out.println("Pham vi nhap vao: "+ts.activity);
		System.out.println("Thong tin lam them: "+checkOvertime(ts.overtime));
		System.out.println("Vi tri nhap vao la:  "+ts.location);
		System.out.println("Ten nhan vien nhap vao la: "+ts.nameEmployee);
		System.out.println("Ten du an nhap vao la: "+ts.nameProject);
		
	}


}
